package androidx.appcompat.app;

import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface.OnKeyListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.view.ViewStub;
import android.view.Window;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.view.ViewCompat;
import androidx.core.widget.NestedScrollView;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import java.lang.ref.WeakReference;
import o.ag;
import o.ah$i;
import o.ah.c;
import o.ah.g;

public class AlertController {
    ListAdapter ʻ;
    private final Context ʻॱ;
    NestedScrollView ʼ;
    private View ʼॱ;
    Message ʽ;
    private int ʽॱ;
    private int ʾ;
    private CharSequence ʿ;
    private int ˈ;
    private Drawable ˉ;
    Message ˊ;
    private int ˊˊ;
    private int ˊˋ;
    int ˊॱ;
    private CharSequence ˊᐝ;
    final ag ˋ;
    private boolean ˋˊ = false;
    private Drawable ˋˋ;
    int ˋॱ;
    private Drawable ˋᐝ;
    private int ˌ = 0;
    private CharSequence ˍ;
    ListView ˎ;
    private CharSequence ˎˎ;
    private View ˎˏ;
    Button ˏ;
    private Drawable ˏˎ;
    private TextView ˏˏ;
    int ˏॱ;
    private TextView ˑ;
    int ͺ = -1;
    private ImageView ͺॱ;
    private int ـ;
    Button ॱ;
    private boolean ॱʻ;
    private int ॱʼ;
    private int ॱʽ = 0;
    int ॱˊ;
    Handler ॱˋ;
    private final Window ॱˎ;
    private final OnClickListener ॱͺ = new OnClickListener(this) {
        final /* synthetic */ AlertController ˏ;

        {
            this.ˏ = r1;
        }

        public void onClick(View view) {
            Message obtain;
            if (view == this.ˏ.ॱ && this.ˏ.ˊ != null) {
                obtain = Message.obtain(this.ˏ.ˊ);
            } else if (view == this.ˏ.ˏ && this.ˏ.ʽ != null) {
                obtain = Message.obtain(this.ˏ.ʽ);
            } else if (view != this.ˏ.ॱॱ || this.ˏ.ᐝ == null) {
                obtain = null;
            } else {
                obtain = Message.obtain(this.ˏ.ᐝ);
            }
            if (obtain != null) {
                obtain.sendToTarget();
            }
            this.ˏ.ॱˋ.obtainMessage(1, this.ˏ.ˋ).sendToTarget();
        }
    };
    Button ॱॱ;
    private CharSequence ॱᐝ;
    Message ᐝ;
    private final int ᐝॱ;

    static final class ButtonHandler extends Handler {
        private WeakReference<DialogInterface> ˋ;

        public ButtonHandler(DialogInterface dialogInterface) {
            this.ˋ = new WeakReference(dialogInterface);
        }

        public void handleMessage(Message message) {
            switch (message.what) {
                case -3:
                case -2:
                case -1:
                    ((DialogInterface.OnClickListener) message.obj).onClick((DialogInterface) this.ˋ.get(), message.what);
                    return;
                case 1:
                    ((DialogInterface) message.obj).dismiss();
                    return;
                default:
                    return;
            }
        }
    }

    static class CheckedItemAdapter extends ArrayAdapter<CharSequence> {
        public CheckedItemAdapter(Context context, int i, int i2, CharSequence[] charSequenceArr) {
            super(context, i, i2, charSequenceArr);
        }

        public boolean hasStableIds() {
            return true;
        }

        public long getItemId(int i) {
            return (long) i;
        }
    }

    public static class RecycleListView extends ListView {
        private final int ˋ;
        private final int ˎ;

        public RecycleListView(Context context) {
            this(context, null);
        }

        public RecycleListView(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, g.ˊᐧ);
            this.ˎ = obtainStyledAttributes.getDimensionPixelOffset(g.ˊꜞ, -1);
            this.ˋ = obtainStyledAttributes.getDimensionPixelOffset(g.ˊﾟ, -1);
        }

        public void setHasDecor(boolean z, boolean z2) {
            if (!z2 || !z) {
                setPadding(getPaddingLeft(), z ? getPaddingTop() : this.ˋ, getPaddingRight(), z2 ? getPaddingBottom() : this.ˎ);
            }
        }
    }

    public static class a {
        public CharSequence ʻ;
        public OnCancelListener ʻॱ;
        public CharSequence ʼ;
        public OnKeyListener ʼॱ;
        public View ʽ;
        public DialogInterface.OnClickListener ʽॱ;
        public ListAdapter ʾ;
        public CharSequence[] ʿ;
        public int ˈ;
        public int ˉ;
        public int ˊ = 0;
        public int ˊˊ;
        public int ˊˋ;
        public CharSequence ˊॱ;
        public View ˊᐝ;
        public int ˋ = 0;
        public int ˋˊ;
        public int ˋˋ = -1;
        public Drawable ˋॱ;
        public boolean ˋᐝ;
        public boolean[] ˌ;
        public boolean ˍ = false;
        public Drawable ˎ;
        public boolean ˎˎ;
        public String ˎˏ;
        public final Context ˏ;
        public OnItemSelectedListener ˏˎ;
        public OnMultiChoiceClickListener ˏˏ;
        public CharSequence ˏॱ;
        public String ˑ;
        public DialogInterface.OnClickListener ͺ;
        public Cursor ͺॱ;
        public a ـ;
        public final LayoutInflater ॱ;
        public DialogInterface.OnClickListener ॱˊ;
        public Drawable ॱˋ;
        public boolean ॱˎ;
        public boolean ॱͺ = true;
        public CharSequence ॱॱ;
        public DialogInterface.OnClickListener ॱᐝ;
        public Drawable ᐝ;
        public OnDismissListener ᐝॱ;

        public interface a {
            void ॱ(ListView listView);
        }

        public a(Context context) {
            this.ˏ = context;
            this.ॱˎ = true;
            this.ॱ = (LayoutInflater) context.getSystemService("layout_inflater");
        }

        public void ˎ(AlertController alertController) {
            if (this.ʽ != null) {
                alertController.ˋ(this.ʽ);
            } else {
                if (this.ॱॱ != null) {
                    alertController.ˏ(this.ॱॱ);
                }
                if (this.ˎ != null) {
                    alertController.ˋ(this.ˎ);
                }
                if (this.ˋ != 0) {
                    alertController.ˏ(this.ˋ);
                }
                if (this.ˊ != 0) {
                    alertController.ˏ(alertController.ˎ(this.ˊ));
                }
            }
            if (this.ʻ != null) {
                alertController.ॱ(this.ʻ);
            }
            if (!(this.ʼ == null && this.ᐝ == null)) {
                alertController.ˊ(-1, this.ʼ, this.ͺ, null, this.ᐝ);
            }
            if (!(this.ˏॱ == null && this.ˋॱ == null)) {
                alertController.ˊ(-2, this.ˏॱ, this.ॱˊ, null, this.ˋॱ);
            }
            if (!(this.ˊॱ == null && this.ॱˋ == null)) {
                alertController.ˊ(-3, this.ˊॱ, this.ॱᐝ, null, this.ॱˋ);
            }
            if (!(this.ʿ == null && this.ͺॱ == null && this.ʾ == null)) {
                ॱ(alertController);
            }
            if (this.ˊᐝ != null) {
                if (this.ˍ) {
                    alertController.ˎ(this.ˊᐝ, this.ˊˊ, this.ˉ, this.ˋˊ, this.ˊˋ);
                    return;
                }
                alertController.ˊ(this.ˊᐝ);
            } else if (this.ˈ != 0) {
                alertController.ˋ(this.ˈ);
            }
        }

        private void ॱ(final AlertController alertController) {
            ListAdapter simpleCursorAdapter;
            final RecycleListView recycleListView = (RecycleListView) this.ॱ.inflate(alertController.ॱˊ, null);
            if (!this.ˎˎ) {
                int i;
                if (this.ˋᐝ) {
                    i = alertController.ˏॱ;
                } else {
                    i = alertController.ˊॱ;
                }
                if (this.ͺॱ != null) {
                    simpleCursorAdapter = new SimpleCursorAdapter(this.ˏ, i, this.ͺॱ, new String[]{this.ˎˏ}, new int[]{16908308});
                } else if (this.ʾ != null) {
                    simpleCursorAdapter = this.ʾ;
                } else {
                    simpleCursorAdapter = new CheckedItemAdapter(this.ˏ, i, 16908308, this.ʿ);
                }
            } else if (this.ͺॱ == null) {
                simpleCursorAdapter = new AlertController$AlertParams$1(this, this.ˏ, alertController.ˋॱ, 16908308, this.ʿ, recycleListView);
            } else {
                Object alertController$AlertParams$2 = new AlertController$AlertParams$2(this, this.ˏ, this.ͺॱ, false, recycleListView, alertController);
            }
            if (this.ـ != null) {
                this.ـ.ॱ(recycleListView);
            }
            alertController.ʻ = simpleCursorAdapter;
            alertController.ͺ = this.ˋˋ;
            if (this.ʽॱ != null) {
                recycleListView.setOnItemClickListener(new OnItemClickListener(this) {
                    final /* synthetic */ a ˎ;

                    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                        this.ˎ.ʽॱ.onClick(alertController.ˋ, i);
                        if (!this.ˎ.ˋᐝ) {
                            alertController.ˋ.dismiss();
                        }
                    }
                });
            } else if (this.ˏˏ != null) {
                recycleListView.setOnItemClickListener(new OnItemClickListener(this) {
                    final /* synthetic */ a ˊ;

                    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                        if (this.ˊ.ˌ != null) {
                            this.ˊ.ˌ[i] = recycleListView.isItemChecked(i);
                        }
                        this.ˊ.ˏˏ.onClick(alertController.ˋ, i, recycleListView.isItemChecked(i));
                    }
                });
            }
            if (this.ˏˎ != null) {
                recycleListView.setOnItemSelectedListener(this.ˏˎ);
            }
            if (this.ˋᐝ) {
                recycleListView.setChoiceMode(1);
            } else if (this.ˎˎ) {
                recycleListView.setChoiceMode(2);
            }
            alertController.ˎ = recycleListView;
        }
    }

    private static boolean ˋ(Context context) {
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(c.ˋॱ, typedValue, true);
        if (typedValue.data != 0) {
            return true;
        }
        return false;
    }

    public AlertController(Context context, ag agVar, Window window) {
        this.ʻॱ = context;
        this.ˋ = agVar;
        this.ॱˎ = window;
        this.ॱˋ = new ButtonHandler(agVar);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, g.ˌ, c.ॱˊ, 0);
        this.ـ = obtainStyledAttributes.getResourceId(g.ˍ, 0);
        this.ॱʼ = obtainStyledAttributes.getResourceId(g.ˑ, 0);
        this.ॱˊ = obtainStyledAttributes.getResourceId(g.ͺॱ, 0);
        this.ˋॱ = obtainStyledAttributes.getResourceId(g.ˏˏ, 0);
        this.ˏॱ = obtainStyledAttributes.getResourceId(g.ˎˏ, 0);
        this.ˊॱ = obtainStyledAttributes.getResourceId(g.ˏˎ, 0);
        this.ॱʻ = obtainStyledAttributes.getBoolean(g.ॱͺ, true);
        this.ᐝॱ = obtainStyledAttributes.getDimensionPixelSize(g.ॱʼ, 0);
        obtainStyledAttributes.recycle();
        agVar.ˎ(1);
    }

    static boolean ˏ(View view) {
        if (view.onCheckIsTextEditor()) {
            return true;
        }
        if (!(view instanceof ViewGroup)) {
            return false;
        }
        ViewGroup viewGroup = (ViewGroup) view;
        int childCount = viewGroup.getChildCount();
        while (childCount > 0) {
            childCount--;
            if (ˏ(viewGroup.getChildAt(childCount))) {
                return true;
            }
        }
        return false;
    }

    public void ˏ() {
        this.ˋ.setContentView(ˎ());
        ॱ();
    }

    private int ˎ() {
        if (this.ॱʼ == 0) {
            return this.ـ;
        }
        if (this.ॱʽ == 1) {
            return this.ॱʼ;
        }
        return this.ـ;
    }

    public void ˏ(CharSequence charSequence) {
        this.ॱᐝ = charSequence;
        if (this.ˑ != null) {
            this.ˑ.setText(charSequence);
        }
    }

    public void ˋ(View view) {
        this.ˎˏ = view;
    }

    public void ॱ(CharSequence charSequence) {
        this.ʿ = charSequence;
        if (this.ˏˏ != null) {
            this.ˏˏ.setText(charSequence);
        }
    }

    public void ˋ(int i) {
        this.ʼॱ = null;
        this.ˈ = i;
        this.ˋˊ = false;
    }

    public void ˊ(View view) {
        this.ʼॱ = view;
        this.ˈ = 0;
        this.ˋˊ = false;
    }

    public void ˎ(View view, int i, int i2, int i3, int i4) {
        this.ʼॱ = view;
        this.ˈ = 0;
        this.ˋˊ = true;
        this.ʽॱ = i;
        this.ʾ = i2;
        this.ˊˊ = i3;
        this.ˊˋ = i4;
    }

    public void ˊ(int i, CharSequence charSequence, DialogInterface.OnClickListener onClickListener, Message message, Drawable drawable) {
        if (message == null && onClickListener != null) {
            message = this.ॱˋ.obtainMessage(i, onClickListener);
        }
        switch (i) {
            case -3:
                this.ˎˎ = charSequence;
                this.ᐝ = message;
                this.ˋˋ = drawable;
                return;
            case -2:
                this.ˍ = charSequence;
                this.ʽ = message;
                this.ˋᐝ = drawable;
                return;
            case -1:
                this.ˊᐝ = charSequence;
                this.ˊ = message;
                this.ˉ = drawable;
                return;
            default:
                throw new IllegalArgumentException("Button does not exist");
        }
    }

    public void ˏ(int i) {
        this.ˏˎ = null;
        this.ˌ = i;
        if (this.ͺॱ == null) {
            return;
        }
        if (i != 0) {
            this.ͺॱ.setVisibility(0);
            this.ͺॱ.setImageResource(this.ˌ);
            return;
        }
        this.ͺॱ.setVisibility(8);
    }

    public void ˋ(Drawable drawable) {
        this.ˏˎ = drawable;
        this.ˌ = 0;
        if (this.ͺॱ == null) {
            return;
        }
        if (drawable != null) {
            this.ͺॱ.setVisibility(0);
            this.ͺॱ.setImageDrawable(drawable);
            return;
        }
        this.ͺॱ.setVisibility(8);
    }

    public int ˎ(int i) {
        TypedValue typedValue = new TypedValue();
        this.ʻॱ.getTheme().resolveAttribute(i, typedValue, true);
        return typedValue.resourceId;
    }

    public boolean ˊ(int i, KeyEvent keyEvent) {
        return this.ʼ != null && this.ʼ.ˊ(keyEvent);
    }

    public boolean ˏ(int i, KeyEvent keyEvent) {
        return this.ʼ != null && this.ʼ.ˊ(keyEvent);
    }

    @Nullable
    private ViewGroup ˋ(@Nullable View view, @Nullable View view2) {
        View inflate;
        if (view == null) {
            if (view2 instanceof ViewStub) {
                inflate = ((ViewStub) view2).inflate();
            } else {
                inflate = view2;
            }
            return (ViewGroup) inflate;
        }
        if (view2 != null) {
            ViewParent parent = view2.getParent();
            if (parent instanceof ViewGroup) {
                ((ViewGroup) parent).removeView(view2);
            }
        }
        if (view instanceof ViewStub) {
            inflate = ((ViewStub) view).inflate();
        } else {
            inflate = view;
        }
        return (ViewGroup) inflate;
    }

    private void ॱ() {
        boolean z;
        boolean z2;
        View findViewById = this.ॱˎ.findViewById(ah$i.ˊˊ);
        View findViewById2 = findViewById.findViewById(ah$i.ᐨ);
        View findViewById3 = findViewById.findViewById(ah$i.ͺ);
        View findViewById4 = findViewById.findViewById(ah$i.ˏॱ);
        ViewGroup viewGroup = (ViewGroup) findViewById.findViewById(ah$i.ʻॱ);
        ˋ(viewGroup);
        View findViewById5 = viewGroup.findViewById(ah$i.ᐨ);
        View findViewById6 = viewGroup.findViewById(ah$i.ͺ);
        View findViewById7 = viewGroup.findViewById(ah$i.ˏॱ);
        ViewGroup ˋ = ˋ(findViewById5, findViewById2);
        ViewGroup ˋ2 = ˋ(findViewById6, findViewById3);
        ViewGroup ˋ3 = ˋ(findViewById7, findViewById4);
        ˎ(ˋ2);
        ˊ(ˋ3);
        ॱ(ˋ);
        boolean z3 = (viewGroup == null || viewGroup.getVisibility() == 8) ? false : true;
        if (ˋ == null || ˋ.getVisibility() == 8) {
            z = false;
        } else {
            z = true;
        }
        if (ˋ3 == null || ˋ3.getVisibility() == 8) {
            z2 = false;
        } else {
            z2 = true;
        }
        if (!(z2 || ˋ2 == null)) {
            findViewById = ˋ2.findViewById(ah$i.ॱͺ);
            if (findViewById != null) {
                findViewById.setVisibility(0);
            }
        }
        if (z) {
            if (this.ʼ != null) {
                this.ʼ.setClipToPadding(true);
            }
            findViewById = null;
            if (!(this.ʿ == null && this.ˎ == null)) {
                findViewById = ˋ.findViewById(ah$i.ᐝˋ);
            }
            if (findViewById != null) {
                findViewById.setVisibility(0);
            }
        } else if (ˋ2 != null) {
            findViewById = ˋ2.findViewById(ah$i.ॱʼ);
            if (findViewById != null) {
                findViewById.setVisibility(0);
            }
        }
        if (this.ˎ instanceof RecycleListView) {
            ((RecycleListView) this.ˎ).setHasDecor(z, z2);
        }
        if (!z3) {
            findViewById3 = this.ˎ != null ? this.ˎ : this.ʼ;
            if (findViewById3 != null) {
                int i;
                if (z) {
                    i = 1;
                } else {
                    i = 0;
                }
                ˎ(ˋ2, findViewById3, (z2 ? 2 : 0) | i, 3);
            }
        }
        ListView listView = this.ˎ;
        if (listView != null && this.ʻ != null) {
            listView.setAdapter(this.ʻ);
            int i2 = this.ͺ;
            if (i2 > -1) {
                listView.setItemChecked(i2, true);
                listView.setSelection(i2);
            }
        }
    }

    private void ˎ(ViewGroup viewGroup, View view, int i, int i2) {
        View view2 = null;
        View findViewById = this.ॱˎ.findViewById(ah$i.ˊᐝ);
        View findViewById2 = this.ॱˎ.findViewById(ah$i.ˊˋ);
        if (VERSION.SDK_INT >= 23) {
            ViewCompat.ˎ(view, i, i2);
            if (findViewById != null) {
                viewGroup.removeView(findViewById);
            }
            if (findViewById2 != null) {
                viewGroup.removeView(findViewById2);
                return;
            }
            return;
        }
        if (findViewById != null && (i & 1) == 0) {
            viewGroup.removeView(findViewById);
            findViewById = null;
        }
        if (findViewById2 == null || (i & 2) != 0) {
            view2 = findViewById2;
        } else {
            viewGroup.removeView(findViewById2);
        }
        if (findViewById != null || view2 != null) {
            if (this.ʿ != null) {
                this.ʼ.setOnScrollChangeListener(new NestedScrollView.c(this) {
                    final /* synthetic */ AlertController ˏ;

                    public void ˏ(NestedScrollView nestedScrollView, int i, int i2, int i3, int i4) {
                        AlertController.ॱ(nestedScrollView, findViewById, view2);
                    }
                });
                this.ʼ.post(new Runnable(this) {
                    final /* synthetic */ AlertController ˊ;

                    public void run() {
                        AlertController.ॱ(this.ˊ.ʼ, findViewById, view2);
                    }
                });
            } else if (this.ˎ != null) {
                this.ˎ.setOnScrollListener(new OnScrollListener(this) {
                    final /* synthetic */ AlertController ˊ;

                    public void onScrollStateChanged(AbsListView absListView, int i) {
                    }

                    public void onScroll(AbsListView absListView, int i, int i2, int i3) {
                        AlertController.ॱ(absListView, findViewById, view2);
                    }
                });
                this.ˎ.post(new Runnable(this) {
                    final /* synthetic */ AlertController ˋ;

                    public void run() {
                        AlertController.ॱ(this.ˋ.ˎ, findViewById, view2);
                    }
                });
            } else {
                if (findViewById != null) {
                    viewGroup.removeView(findViewById);
                }
                if (view2 != null) {
                    viewGroup.removeView(view2);
                }
            }
        }
    }

    private void ˋ(ViewGroup viewGroup) {
        View view;
        boolean z = false;
        if (this.ʼॱ != null) {
            view = this.ʼॱ;
        } else if (this.ˈ != 0) {
            view = LayoutInflater.from(this.ʻॱ).inflate(this.ˈ, viewGroup, false);
        } else {
            view = null;
        }
        if (view != null) {
            z = true;
        }
        if (!(z && ˏ(view))) {
            this.ॱˎ.setFlags(WXMediaMessage.MINI_PROGRAM__THUMB_LENGHT, WXMediaMessage.MINI_PROGRAM__THUMB_LENGHT);
        }
        if (z) {
            FrameLayout frameLayout = (FrameLayout) this.ॱˎ.findViewById(ah$i.ˊॱ);
            frameLayout.addView(view, new LayoutParams(-1, -1));
            if (this.ˋˊ) {
                frameLayout.setPadding(this.ʽॱ, this.ʾ, this.ˊˊ, this.ˊˋ);
            }
            if (this.ˎ != null) {
                ((LinearLayoutCompat.LayoutParams) viewGroup.getLayoutParams()).ʼ = 0.0f;
                return;
            }
            return;
        }
        viewGroup.setVisibility(8);
    }

    private void ॱ(ViewGroup viewGroup) {
        if (this.ˎˏ != null) {
            viewGroup.addView(this.ˎˏ, 0, new LayoutParams(-1, -2));
            this.ॱˎ.findViewById(ah$i.ᐧ).setVisibility(8);
            return;
        }
        this.ͺॱ = (ImageView) this.ॱˎ.findViewById(16908294);
        if ((!TextUtils.isEmpty(this.ॱᐝ) ? 1 : 0) == 0 || !this.ॱʻ) {
            this.ॱˎ.findViewById(ah$i.ᐧ).setVisibility(8);
            this.ͺॱ.setVisibility(8);
            viewGroup.setVisibility(8);
            return;
        }
        this.ˑ = (TextView) this.ॱˎ.findViewById(ah$i.ˋॱ);
        this.ˑ.setText(this.ॱᐝ);
        if (this.ˌ != 0) {
            this.ͺॱ.setImageResource(this.ˌ);
        } else if (this.ˏˎ != null) {
            this.ͺॱ.setImageDrawable(this.ˏˎ);
        } else {
            this.ˑ.setPadding(this.ͺॱ.getPaddingLeft(), this.ͺॱ.getPaddingTop(), this.ͺॱ.getPaddingRight(), this.ͺॱ.getPaddingBottom());
            this.ͺॱ.setVisibility(8);
        }
    }

    private void ˎ(ViewGroup viewGroup) {
        this.ʼ = (NestedScrollView) this.ॱˎ.findViewById(ah$i.ˋˊ);
        this.ʼ.setFocusable(false);
        this.ʼ.setNestedScrollingEnabled(false);
        this.ˏˏ = (TextView) viewGroup.findViewById(16908299);
        if (this.ˏˏ != null) {
            if (this.ʿ != null) {
                this.ˏˏ.setText(this.ʿ);
                return;
            }
            this.ˏˏ.setVisibility(8);
            this.ʼ.removeView(this.ˏˏ);
            if (this.ˎ != null) {
                ViewGroup viewGroup2 = (ViewGroup) this.ʼ.getParent();
                int indexOfChild = viewGroup2.indexOfChild(this.ʼ);
                viewGroup2.removeViewAt(indexOfChild);
                viewGroup2.addView(this.ˎ, indexOfChild, new LayoutParams(-1, -1));
                return;
            }
            viewGroup.setVisibility(8);
        }
    }

    static void ॱ(View view, View view2, View view3) {
        int i = 0;
        if (view2 != null) {
            view2.setVisibility(view.canScrollVertically(-1) ? 0 : 4);
        }
        if (view3 != null) {
            if (!view.canScrollVertically(1)) {
                i = 4;
            }
            view3.setVisibility(i);
        }
    }

    private void ˊ(ViewGroup viewGroup) {
        int i;
        int i2 = 1;
        this.ॱ = (Button) viewGroup.findViewById(16908313);
        this.ॱ.setOnClickListener(this.ॱͺ);
        if (TextUtils.isEmpty(this.ˊᐝ) && this.ˉ == null) {
            this.ॱ.setVisibility(8);
            i = 0;
        } else {
            this.ॱ.setText(this.ˊᐝ);
            if (this.ˉ != null) {
                this.ˉ.setBounds(0, 0, this.ᐝॱ, this.ᐝॱ);
                this.ॱ.setCompoundDrawables(this.ˉ, null, null, null);
            }
            this.ॱ.setVisibility(0);
            i = 1;
        }
        this.ˏ = (Button) viewGroup.findViewById(16908314);
        this.ˏ.setOnClickListener(this.ॱͺ);
        if (TextUtils.isEmpty(this.ˍ) && this.ˋᐝ == null) {
            this.ˏ.setVisibility(8);
        } else {
            this.ˏ.setText(this.ˍ);
            if (this.ˋᐝ != null) {
                this.ˋᐝ.setBounds(0, 0, this.ᐝॱ, this.ᐝॱ);
                this.ˏ.setCompoundDrawables(this.ˋᐝ, null, null, null);
            }
            this.ˏ.setVisibility(0);
            i |= 2;
        }
        this.ॱॱ = (Button) viewGroup.findViewById(16908315);
        this.ॱॱ.setOnClickListener(this.ॱͺ);
        if (TextUtils.isEmpty(this.ˎˎ) && this.ˋˋ == null) {
            this.ॱॱ.setVisibility(8);
        } else {
            this.ॱॱ.setText(this.ˎˎ);
            if (this.ˉ != null) {
                this.ˉ.setBounds(0, 0, this.ᐝॱ, this.ᐝॱ);
                this.ॱ.setCompoundDrawables(this.ˉ, null, null, null);
            }
            this.ॱॱ.setVisibility(0);
            i |= 4;
        }
        if (ˋ(this.ʻॱ)) {
            if (i == 1) {
                ˎ(this.ॱ);
            } else if (i == 2) {
                ˎ(this.ˏ);
            } else if (i == 4) {
                ˎ(this.ॱॱ);
            }
        }
        if (i == 0) {
            i2 = 0;
        }
        if (i2 == 0) {
            viewGroup.setVisibility(8);
        }
    }

    private void ˎ(Button button) {
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams();
        layoutParams.gravity = 1;
        layoutParams.weight = 0.5f;
        button.setLayoutParams(layoutParams);
    }
}
